home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 151-175 / disk_166 / stevie / bugs / bug1 / unix.c.diff < prev   
Text File  |  1992-05-06  |  2KB  |  90 lines

  1. 2a3
  2. >  * modifications by:  Robert Regn       rtregn@faui32.uucp
  3. 5a7,21
  4. > #ifdef MINIX
  5. > #include <sgtty.h>
  6. > char *strchr(s, c)
  7. > register char *s;
  8. > {
  9. >     while (*s) {
  10. >         if (*s == c)
  11. >             return s;
  12. >         s++;
  13. >     }
  14. >     return 0;
  15. > }
  16. > #else
  17. 6a23
  18. > #endif
  19. 94a112,114
  20. > #ifdef MINIX
  21. > static    struct    sgttyb    ostate;
  22. > #else
  23. 95a116
  24. > #endif
  25. 101a123,141
  26. > #ifdef MINIX
  27. >     struct    sgttyb    nstate;
  28. >     if ((term = getenv("TERM")) == NULL || strcmp(term, "minix") != 0) {
  29. >         fprintf(stderr, "Invalid terminal type '%s'\n", term);
  30. >         exit(1);
  31. >     }
  32. >     Columns = 80;
  33. >     P(P_LI) = Rows = 24;
  34. >     /*
  35. >      * Go into cbreak mode
  36. >      */
  37. >      ioctl(0, TIOCGETP, &ostate);
  38. >      nstate = ostate;
  39. >      nstate.sg_flags |= CBREAK;
  40. >      nstate.sg_flags &= ~ECHO;
  41. >      ioctl(0, TIOCSETP, &nstate);
  42. > #else
  43. 119a160
  44. > #endif
  45. 128a170,173
  46. >     flushbuf();
  47. > #ifdef MINIX
  48. >     ioctl(0, TIOCSETP, &ostate);
  49. > #else
  50. 129a175
  51. > #endif
  52. 132a179,211
  53. > #ifdef MINIX
  54. > void
  55. > doshell()
  56. > {
  57. >     char    *sh, *getenv();
  58. >     struct    sgttyb    nstate;
  59. >     if ((sh = getenv("SHELL")) == NULL) {
  60. >         sh = "/bin/sh";
  61. >     }
  62. >     gotocmd(TRUE, FALSE, 0);
  63. >     switch (fork() ) {
  64. >         case    0:    ioctl(0, TIOCSETP, &ostate);
  65. >                 write(1,"\n", 1);
  66. >                 execl(sh, "sh", "-i", 0);
  67. >                 write(1,"Exec failed", 11);
  68. >                 exit(1);
  69. >         case    -1:    emsg("fork failed");
  70. >                 break;
  71. >         default:    wait(0);
  72. >                 nstate = ostate;
  73. >                 nstate.sg_flags |= CBREAK;
  74. >                 nstate.sg_flags &= ~ECHO;
  75. >                 ioctl(0, TIOCSETP, &nstate);
  76. >     }
  77. >     wait_return();
  78. > }
  79. > #endif
  80.